package net.zoneland.knowledge.model;

import java.io.Serializable;
import java.util.Date;
import java.util.Optional;

import org.springframework.format.annotation.DateTimeFormat;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;

import net.zoneland.knowledge.constant.Constants;
import net.zoneland.knowledge.enums.AttachTypeEnum;

/**
 * 工单子任务附件.
 * @author zmq
 * @Date 2022/8/9 10:16
 */
public class WorkApplyInfoAttachment implements Serializable {
  private static final long serialVersionUID = 5885764835790757708L;
  /**
   * 主键.
   */
  private String id;
  /**
   * 上传用户uid.
   */
  private String uploaderUid;
  /**
   * 上传用户姓名.
   */
  private String uploaderName;
  /**
   * 附件.
   */
  @JsonIgnore
  private byte[] attachment;
  /**
   * 文件名称.
   */
  private String fileName;
  /**
   * 是否只读.
   */
  private boolean onlyRead;
  /**
   * 上传时间.
   */
  @JsonFormat(pattern = Constants.DATE_TIME_FORMAT_DEFAULT)
  @DateTimeFormat(pattern = Constants.DATE_TIME_FORMAT_DEFAULT)
  private Date uploadTime;
  /**
   * 工单主键id.
   */
  private String workApplyId;
    /**
   * 分任务主键id.
   */
  private String subTaskId;

    /**
   * 文件在wps的fileId.
   */
  private String wpsFileId;

  /**
   * 获取分任务id
   * 
   * @return 分任务id
   */
  public String getSubTaskId() {
    return subTaskId;
  }

  /**
   * 设置分任务id
   * 
   * @param subTaskId 分任务id
   */
  public void setSubTaskId(String subTaskId) {
    this.subTaskId = subTaskId;
  }

  /**
   * 类型.
   */
  private AttachTypeEnum type;
  /**
   * 获取 属性值.
   * @return 属性值
   */
  public AttachTypeEnum getType() {
    return type;
  }
  /**
   * 设置 属性值.
   * @param type 属性值
   */
  public void setType(AttachTypeEnum type) {
    this.type = type;
  }
  /**
   * 获取 属性值.
   * @return 属性值
   */
  public String getWorkApplyId() {
    return workApplyId;
  }
  /**
   * 设置 属性值.
   * @param workApplyId 属性值
   */
  public void setWorkApplyId(final String workApplyId) {
    this.workApplyId = workApplyId;
  }
  /**
   * 获取 属性值.
   * @return 属性值
   */
  public String getId() {
    return id;
  }
  /**
   * 设置 属性值.
   * @param id 属性值
   */
  public void setId(final String id) {
    this.id = id;
  }
  /**
   * 获取 属性值.
   * @return 属性值
   */
  public String getUploaderUid() {
    return uploaderUid;
  }
  /**
   * 设置 属性值.
   * @param uploaderUid 属性值
   */
  public void setUploaderUid(final String uploaderUid) {
    this.uploaderUid = uploaderUid;
  }
  /**
   * 获取 属性值.
   * @return 属性值
   */
  public String getUploaderName() {
    return uploaderName;
  }
  /**
   * 设置 属性值.
   * @param uploaderName 属性值
   */
  public void setUploaderName(final String uploaderName) {
    this.uploaderName = uploaderName;
  }
  /**
   * 获取 属性值.
   * @return 属性值
   */
  public byte[] getAttachment() {
    return attachment;
  }
  /**
   * 设置 属性值.
   * @param attachment 属性值
   */
  public void setAttachment(final byte[] attachment) {
    this.attachment = attachment;
  }
  /**
   * 获取 属性值.
   * @return 属性值
   */
  public String getFileName() {
    return fileName;
  }
  /**
   * 设置 属性值.
   * @param fileName 属性值
   */
  public void setFileName(final String fileName) {
    this.fileName = fileName;
  }
  /**
   * 获取 属性值.
   * @return 属性值
   */
  public boolean isOnlyRead() {
    return onlyRead;
  }
  /**
   * 设置 属性值.
   * @param onlyRead 属性值
   */
  public void setOnlyRead(final boolean onlyRead) {
    this.onlyRead = onlyRead;
  }

  /**
   * 获取 属性值.
   * @return 属性值
   */
  public Date getUploadTime() {
    return Optional.ofNullable(uploadTime).map(it -> (Date)it.clone()).orElse(null);
  }
  /**
   * 设置 属性值.
   * @param uploadTime 属性值
   */
  public void setUploadTime(final Date uploadTime) {
    this.uploadTime = Optional.ofNullable(uploadTime).map(it -> (Date)it.clone()).orElse(null);
  }

  /**
   * 获取 文件在wps的fileId.
   *
   * @return wpsFileId 文件在wps的fileId.
   */
  public String getWpsFileId() {
    return this.wpsFileId;
  }

  /**
   * 设置 文件在wps的fileId.
   *
   * @param wpsFileId 文件在wps的fileId.
   */
  public void setWpsFileId(final String wpsFileId) {
    this.wpsFileId = wpsFileId;
  }
}
